using System;
using AutoPoco.Configuration;
using Autopoco.Contrib.DataSources;
using Autopoco.Contrib.Test.SampleData;

namespace Autopoco.Contrib.Test.DataGenerator
{
    public class SampleEntityDataGenerator : BaseDataGenerator<SampleEntity>
    {
        #region Overrides of BaseDataGenerator<SampleEntity>

        public override IEngineConfigurationBuilder Configure(IEngineConfigurationBuilder configurationBuilder)
        {
            var context = new RelationContext();
            configurationBuilder.Include<SampleEntity>()
                .Setup(e => e.Amount).Use<RandomDoubleSource>()
                .Setup(e => e.Date).Use<RandomDatetimeSource>()
                .Setup(e => e.Number).Use<RelationalDataSource<SequentialIterativeLongSource, long>>(context, 0)
                .Setup(e => e.Serial).Use<RelationalDataSource<SequentialIntSource, int>>(context, 1)
                .Setup(e => e.Type).Use<EnumDataSource<SampleEntityType>>();
            IsConfigured = true;
            return configurationBuilder;
        }

        #endregion
    }
}